package com.itranswarp.learnjava.service;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class CartService {
    //通过用户id哪购物车中货物信息
    public List<Goods> getUserGoods(long userid, List<Goods> goodsData){
        List<Goods> goodsList = new ArrayList<>();
        for (var goods:
             goodsData) {
            if(goods.getUserId()==userid)
            {
                goodsList.add(goods);
            }
        }
        return goodsList;
    }
}
